package com.yanggu.flink.datastream_api.source

import org.apache.flink.streaming.api.scala._

/**
 * 从socket中读取数据, 一般用于测试。且不能设置并行度, 只能为1
 */
object SourceFromSocket {

  def main(args: Array[String]): Unit = {
    val env = StreamExecutionEnvironment.getExecutionEnvironment

    //socketTextStream返回的是String类型
    env.socketTextStream("localhost", 8888)
      .print("socket source test").setParallelism(1)

    env.execute()
  }

}
